import { normalizeContainer } from '../../../element/Func';
import { win_direct_drag_mana } from '../Classes/cla_win_direct_drag_mana';

let win_dragEl_mana = new win_direct_drag_mana();

/**
 * 初始化 元素 为 可拽动元素
 * @param {HTMLElement} element
 */
function initDrag(element) {
  element = normalizeContainer(element);

  let compedEl = window.getComputedStyle(element);

  if (!['absolute', 'relative'].includes(compedEl.position)) {
    console.log('sorry ', element, ' position is not "absolute" or "relative"');
    return;
  }

  win_dragEl_mana.active_dragEl(element);
}

/**
 * 初始化 元素 为 可拽动元素
 * @param {HTMLElement} element
 */
function removeDrag(element) {
  element = normalizeContainer(element);

  win_dragEl_mana.remove_dragEl(element);
}

export { initDrag, removeDrag };
